package com.dream.service.recommender.toolkits.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;


public class SHA1 {

    private static String salt = "motif@fyf&hs*lgj!lwc#lcm$yyf+Onclick-Stream";

    public static String encode (String encryptStr) {
        try {
            MessageDigest md = MessageDigest.getInstance("SHA-1");
            md.update((encryptStr + salt).getBytes());
            return new BigInteger(1, md.digest()).toString(16);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }
    }
}
